package com.itheima.tlias.controller;

import com.itheima.tlias.service.ReportService;
import com.itheima.tlias.pojo.ClassOption;
import com.itheima.tlias.pojo.JobOption;
import com.itheima.tlias.pojo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 统计报表控制器
 *
 * @Author mr.luo
 * @Date 11 4月 2025 16:03
 */
@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    /**
     * 职位数据统计
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    /**
     * 员工性别统计
     */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData() {
        List<Map> data = reportService.getEmpGenderData();
        log.info("员工性别统计：{}", data);
        return Result.success(data);
    }

    /**
     * 学生学历统计
     */
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData() {
        List<Map> data = reportService.getStudentDegreeData();
        log.info("学生学历统计：{}", data);
        return Result.success(data);
    }
    /**
     * 班级人数统计
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData() {
       ClassOption classOption = reportService.getStudentCountData();
        log.info("班级人数统计：{}", classOption);
        return Result.success(classOption);
    }

}
